package com.probiz.estore.system.service;

import java.util.List;
import java.util.Map;

import com.probiz.estore.common.model.system.AppMenu;
import com.probiz.estore.core.search.SearchCriteria;
import com.probiz.estore.core.service.GenericManager;

/**
 * Manager interface for AppMenu, responsible for business processing, and communicate between web and persistence layer.
 *
 */
public interface AppMenuManager extends GenericManager<AppMenu> {
	/**
	 * 是否已存在相同的匹配串
	 * @param patternString
	 * @param excludeResourceId
	 * @return
	 */
	public boolean isPatternExist(String patternString, Integer excludeResourceId);
	
	/**
	 * 用于后台对菜单、权限的搜索
	 * @param sc
	 * @param belongTo
	 * @return
	 */
	public List<AppMenu> searchByCriteria(SearchCriteria sc,Short belongTo);
	
	/**
	 * 返回所有菜单、权限
	 * @param belongTo
	 * @param type
	 * @return
	 */
	public List<AppMenu> findAllMenus(Short belongTo,Short type);
	
	/**
	 * 返回一级菜单、权限
	 * @param belongTo
	 * @param type
	 * @return
	 */
	public List<AppMenu> findTopMenus(Short belongTo,Short type);
	/**
	 * 返回菜单权限的子集合
	 * @param parentId
	 * @return
	 */
	public List<AppMenu> findChildrenByMenuId(Integer parentId);
	/**
	 * 保存菜单、权限，用于从menu-config.xml导入时
	 * @param menu
	 */
	public void configToDb(AppMenu menu);
	/**
	 * 根据名称获取菜单、权限
	 * @param menuName
	 * @return
	 */
	public AppMenu getAppMenuByMenuName(String menuName);
	/**
	 * 保存菜单、权限实体
	 * @param isNew
	 * @param menu
	 */
	public void saveFully(boolean isNew,AppMenu menu);
	/**
	 * 根据菜单、权限Id删除实体。
	 * @param appMenuId
	 */
	public Map<String,Object> deleteFully(Integer appMenuId);

	/**
	 * 更新排序
	 * @param menuIds
	 */
	public void updateMenusSortOrder(Integer[] menuIds);
}
